home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initHUDScripts.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  17.0 KB  |  749 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Sept 1996
  22. //  Author:         Lonnie Li
  23. //
  24. //  Description:
  25. //      This script performs various GUI startup related tasks.
  26. //        It is run only in GUI mode and not batch mode.
  27. //
  28. //  Input Arguments:
  29. //      None.
  30. //
  31. //  Return Value:
  32. //      None.
  33. //
  34. //  Note:
  35. //      None.
  36. // 
  37.  
  38. //Object Details Procedures
  39. //
  40. //Backfaces
  41. //Smoothness (Nurbs and Subdivs only)
  42. //Instance
  43. //Display Layer
  44.  
  45. //Command scripts
  46. //
  47.     //Note: Due to the behaviour of the filterExpand command, code has been added
  48.     //      to circumvent "N/A" return value when an intermediate node is selected 
  49.     //      in a given hierarchy. (ie. Parent nodes) The filterExpand command filters 
  50.     //      out only the leaf nodes of the hierarchy, thus returning only the shapes 
  51.     //      of any parent nodes, followed by the children of the node, in that order. 
  52.     //      It is to be noted that filterExpand returns the shape of the currently 
  53.     //      selected parent node in the string array, so a check is made to 
  54.     //      ensure the main selection objects refer to the same object.
  55.     //
  56.     //      This relates to both objectDetailsBackfaces() and objectDetailsSmoothness().
  57. //
  58. global proc string objectDetailsBackfaces()
  59. {
  60.     string $result;
  61.     int $hasResult = false;
  62.  
  63.     global int $gSelectMeshesBit;
  64.     global int $gSelectNurbsSurfacesBit;
  65.  
  66.     string $selectedObjects[] = `ls -sl -o`;
  67.     string $mainObject;
  68.     string $mainShape;
  69.     int $aSelectedObjectExists = 0;
  70.  
  71.     int $hasChildren = 0;
  72.     int $isValid = 0;
  73.  
  74.     if (size($selectedObjects) > 0)
  75.     {
  76.         $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ];
  77.         $aSelectedObjectExists = 1;
  78.  
  79.         //Check if this node has any children (ie. it is a parent node)
  80.         string $children[] = `listRelatives -c $mainObject`;
  81.         string $shapes[] = `listRelatives -s $mainObject`;
  82.  
  83.         $mainShape = $shapes[0];
  84.  
  85.         if (size($children) > 1)
  86.         {
  87.             $hasChildren = 1;
  88.         }
  89.         else if (size($children) == 1)
  90.         {
  91.             if ($mainShape != $children[0])
  92.             {
  93.                 $hasChildren = 1;
  94.             }
  95.         }
  96.     }
  97.  
  98.     string $surface;
  99.  
  100.     string $meshSurfaces[] = `filterExpand -sm $gSelectMeshesBit 
  101.         $selectedObjects`;
  102.  
  103.     int $aSelectedMeshSurfaceExists = 0;
  104.  
  105.     if (size($meshSurfaces) > 0)
  106.     {    
  107.         if ($hasChildren)
  108.         {
  109.             for ($surface in $meshSurfaces)
  110.             {
  111.                 if ($mainShape == $surface)
  112.                 {
  113.                     $isValid = 1;
  114.                     break;
  115.                 }
  116.             }
  117.         }
  118.         else if ($meshSurfaces[ (size($meshSurfaces) - 1) ] == $mainObject)
  119.         {
  120.             $isValid = 1;
  121.         }
  122.         $aSelectedMeshSurfaceExists = 1;
  123.     }
  124.  
  125.     string $nurbsSurfaces[] = `filterExpand -sm $gSelectNurbsSurfacesBit 
  126.         $selectedObjects`;
  127.     int $aSelectedNurbsSurfaceExists = 0;
  128.  
  129.     if (size($nurbsSurfaces) > 0)
  130.     {
  131.         if ($hasChildren)
  132.         {
  133.             for ($surface in $nurbsSurfaces)
  134.             {
  135.                 if ($mainShape == $surface)
  136.                 {
  137.                     $isValid = 1;
  138.                     break;
  139.                 }
  140.             }
  141.         }
  142.         else if ($nurbsSurfaces[ (size($nurbsSurfaces) - 1) ] == $mainObject)
  143.         {
  144.             $isValid = 1;
  145.         }
  146.         $aSelectedNurbsSurfaceExists = 1;
  147.     }
  148.  
  149.     if ($aSelectedObjectExists)
  150.     {
  151.         if ($aSelectedMeshSurfaceExists && $isValid)
  152.         {
  153.             int $backfaces[] = `polyOptions -q -bc $mainObject`;
  154.             if ($backfaces[0])
  155.             {
  156.                 $result = "On";
  157.             }
  158.             else
  159.             {
  160.                 $result = "Off";
  161.             }
  162.             $hasResult = true;
  163.         }
  164.         else if ($aSelectedNurbsSurfaceExists && $isValid)
  165.         {
  166.             if (!`displayCull -q -bfc $mainObject`)
  167.             {
  168.                 $result = "On";
  169.             }
  170.             else
  171.             {
  172.                 $result = "Off";
  173.             }
  174.             $hasResult = true;
  175.         }
  176.     }
  177.  
  178.     if (!$hasResult)
  179.     {
  180.         //No selected objects or no selected objects of valid type
  181.         $result = "N/A";
  182.     }
  183.  
  184.     return $result;
  185. }
  186.  
  187. global proc string objectDetailsSmoothness()
  188. {
  189.     string $result;
  190.     int $hasResult = false;
  191.  
  192.     global int $gSelectNurbsSurfacesBit;
  193.     global int $gSelectSubdivSurface;
  194.  
  195.     string $selectedObjects[] = `ls -sl -o`;
  196.     string $mainObject;
  197.     string $mainShape;
  198.     int $aSelectedObjectExists = 0;
  199.  
  200.     int $hasChildren = 0;
  201.     int $isValid = 0;
  202.  
  203.     if (size($selectedObjects) > 0)
  204.     {
  205.         $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ];
  206.         $aSelectedObjectExists = 1;
  207.  
  208.         //Check if this node has any children (ie. it is a parent node)
  209.         string $children[] = `listRelatives -c $mainObject`;
  210.         string $shapes[] = `listRelatives -s $mainObject`;
  211.  
  212.         $mainShape = $shapes[0];
  213.  
  214.         if (size($children) > 1)
  215.         {
  216.             $hasChildren = 1;
  217.         }
  218.         else if (size($children) == 1)
  219.         {
  220.             if ($mainShape != $children[0])
  221.             {
  222.                 $hasChildren = 1;
  223.             }
  224.         }
  225.     }
  226.  
  227.     string $surface;
  228.  
  229.     string $nurbsSurfaces[] = `filterExpand -ex true 
  230.         -sm $gSelectNurbsSurfacesBit $selectedObjects`;
  231.     int $aSelectedNurbsSurfaceExists = 0;
  232.  
  233.     if (size($nurbsSurfaces) > 0)
  234.     {
  235.         if ($hasChildren)
  236.         {
  237.             for ($surface in $nurbsSurfaces)
  238.             {
  239.                 if ($mainShape == $surface)
  240.                 {
  241.                     $isValid = 1;
  242.                     break;
  243.                 }
  244.             }
  245.         }
  246.         else if ($nurbsSurfaces[ (size($nurbsSurfaces) - 1) ] == $mainObject)
  247.         {
  248.             $isValid = 1;
  249.         }
  250.         $aSelectedNurbsSurfaceExists = 1;
  251.     }
  252.  
  253.     string $subdivSurfaces[] = `filterExpand -ex true
  254.         -sm $gSelectSubdivSurface $selectedObjects`;
  255.     int $aSelectedSubdivSurfaceExists = 0;
  256.  
  257.     if (size($subdivSurfaces) > 0)
  258.     {
  259.         if ($hasChildren)
  260.         {
  261.             for ($surface in $subdivSurfaces)
  262.             {
  263.                 if ($mainShape == $surface)
  264.                 {
  265.                     $isValid = 1;
  266.                     break;
  267.                 }
  268.             }
  269.         }
  270.         else if ($subdivSurfaces[ (size($subdivSurfaces) - 1) ] == $mainObject)
  271.         {
  272.             $isValid = 1;
  273.         }
  274.         $aSelectedSubdivSurfaceExists = 1;
  275.     }
  276.  
  277.     if ($aSelectedObjectExists)
  278.     {
  279.         if ($aSelectedNurbsSurfaceExists && $isValid)
  280.         {
  281.             // NURBS Surface
  282.             //
  283.             //"Hull"    displaySmoothness -hull;
  284.             //"Rough"     displaySmoothness -du 0 -dv 0 -pw 4 -ps 1;
  285.             //"Medium"    displaySmoothness -du 1 -dv 1 -pw 8 -ps 2;
  286.             //"Fine"    displaySmoothness -du 2 -dv 2 -pw 16 -ps 4;
  287.  
  288.             int $smoothness[] = `displaySmoothness -q -du -dv -pw -ps $mainObject`;
  289.             int $isFull[] = `displaySmoothness -q -full $mainObject`;
  290.             int $isHull[] = `displaySmoothness -q -hull $mainObject`;
  291.  
  292.             if (size($smoothness) == 0)
  293.             {
  294.                 //Is not a Nurbs/Subdiv surface
  295.                 $result = "N/A";
  296.             }
  297.             else if ($isHull[0])
  298.             {
  299.                 //Is Hull
  300.                 $result = "Hull";
  301.             }
  302.             else if ($smoothness[0] == 0 &&
  303.                    $smoothness[1] == 0 &&
  304.                    $smoothness[2] == 4 &&
  305.                    $smoothness[3] == 1 &&
  306.                    $isFull[0])
  307.             {
  308.                 //Is Rough
  309.                 $result = "Rough";
  310.             }
  311.             else if ($smoothness[0] == 1 &&
  312.                    $smoothness[1] == 1 &&
  313.                    $smoothness[2] == 8 &&
  314.                    $smoothness[3] == 2 &&
  315.                    $isFull[0])
  316.             {
  317.                 //Is Medium
  318.                 $result = "Medium";
  319.             }
  320.             else if ($smoothness[0] == 2 &&
  321.                    $smoothness[1] == 2 &&
  322.                    $smoothness[2] == 16 &&
  323.                    $smoothness[3] == 4 &&
  324.                    $isFull[0])
  325.             {
  326.                 //Is Fine
  327.                 $result = "Fine";
  328.             }
  329.             else
  330.             {
  331.                 //Is Custom
  332.                 $result = "Custom";
  333.             }
  334.  
  335.             $hasResult = true;
  336.         }
  337.         else if ($aSelectedSubdivSurfaceExists && $isValid)
  338.         {
  339.             //Subdiv Surface
  340.             //
  341.             //"Hull"    subdivDisplaySmoothness -s 0;
  342.             //"Rough"    subdivDisplaySmoothness -s 1;
  343.             //"Medium"    subdivDisplaySmoothness -s 2;
  344.             //"Fine"    subdivDisplaySmoothness -s 3;
  345.  
  346.             int $smoothness[] = `subdivDisplaySmoothness -q $mainObject`;
  347.  
  348.             switch ($smoothness[0])
  349.             {
  350.             case 0:
  351.                 $result = "Hull";
  352.             case 1:
  353.                 $result = "Rough";
  354.             case 2:
  355.                 $result = "Medium";
  356.             case 3:
  357.                 $result = "Fine";
  358.             default:
  359.                 $result = "Custom";
  360.             }
  361.  
  362.             $hasResult = true;
  363.         }
  364.     }
  365.  
  366.     if (!$hasResult)
  367.     {
  368.         //No selected objects or no selected objects of valid type
  369.         $result = "N/A";
  370.     }
  371.  
  372.     return $result;
  373. }
  374.  
  375. global proc string objectDetailsInstance()
  376. {
  377.     string $result;
  378.     int $hasResult = false;
  379.  
  380.     string $selectedObjects[] = `ls -sl`;
  381.     string $mainObject;
  382.     int $aSelectedObjectExists = 0;
  383.  
  384.     if (size($selectedObjects) > 0)
  385.     {
  386.         $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ];
  387.         $aSelectedObjectExists = 1;
  388.     }
  389.  
  390.     if ($aSelectedObjectExists)
  391.     {
  392.         string $mainShape[] = `listRelatives -fullPath -s $mainObject`;
  393.  
  394.         if (size($mainShape))
  395.         {
  396.             string $mainShapeParents[] = `listRelatives -ap $mainShape[0]`;
  397.  
  398.             if (size($mainShapeParents) > 1)
  399.             {
  400.                 $result = "Yes";
  401.             }
  402.             else
  403.             {
  404.                 $result = "No";
  405.             }
  406.  
  407.             $hasResult = true;
  408.         }
  409.     }
  410.  
  411.     if (!$hasResult)
  412.     {
  413.         //No selected objects 
  414.         $result = "N/A";
  415.     }
  416.  
  417.     return $result;
  418. }
  419.  
  420. global proc string objectDetailsDisplayLayer()
  421. {
  422.     string $result;
  423.     int $hasResult = false;
  424.  
  425.     string $selectedObjects[] = `ls -sl -o`;
  426.     string $mainObject;
  427.  
  428.     int $aSelectedObjectExists = 0;
  429.  
  430.     if (size($selectedObjects) > 0)
  431.     {
  432.         $mainObject = $selectedObjects[ (size($selectedObjects) - 1) ];
  433.         $aSelectedObjectExists = 1;
  434.     }
  435.  
  436.     if ($aSelectedObjectExists)
  437.     {
  438.         if (`objExists ($mainObject + ".drawOverride")`)
  439.         {
  440.             string $layerDrawInfo = `connectionInfo -sfd ($mainObject + ".drawOverride")`;
  441.  
  442.             //Now tokenize the layerDrawInfo string
  443.             string $layerStringArray[];
  444.             int $numTokens = `tokenize $layerDrawInfo "." $layerStringArray`;
  445.  
  446.             if (`objExists $layerStringArray[0]`)
  447.             {
  448.                 $result = $layerStringArray[0];
  449.             }
  450.             else
  451.             {
  452.                 $result = "default";
  453.             }
  454.  
  455.             $hasResult = true;
  456.         }
  457.     }
  458.  
  459.     if (!$hasResult)
  460.     {
  461.         $result = "N/A";
  462.     }
  463.  
  464.     return $result;
  465. }
  466.  
  467. //Toggle methods
  468. //
  469. global proc setObjectDetailsVisibility(int $visibility)
  470. {
  471.     if (`headsUpDisplay -ex HUDObjDetBackfaces`)
  472.     {
  473.         headsUpDisplay -e -vis $visibility HUDObjDetBackfaces;
  474.     }
  475.     if (`headsUpDisplay -ex HUDObjDetSmoothness`)
  476.     {
  477.         headsUpDisplay -e -vis $visibility HUDObjDetSmoothness;
  478.     }
  479.     if (`headsUpDisplay -ex HUDObjDetInstance`)
  480.     {
  481.         headsUpDisplay -e -vis $visibility HUDObjDetInstance;
  482.     }
  483.     if (`headsUpDisplay -ex HUDObjDetDispLayer`)
  484.     {
  485.         headsUpDisplay -e -vis $visibility HUDObjDetDispLayer;
  486.     }
  487.     if (`headsUpDisplay -ex HUDObjDetDistFromCam`)
  488.     {
  489.         headsUpDisplay -e -vis $visibility HUDObjDetDistFromCam;
  490.     }
  491.  
  492.     //Update the respective menu item and optionVar
  493.     menuItem -e -cb $visibility objectDetailsItem;
  494.     optionVar -iv "objectDetailsVisibility" $visibility;
  495. }
  496.  
  497. global proc setPolyCountVisibility(int $visibility)
  498. {
  499.     if (`headsUpDisplay -ex HUDPolyCountVerts`)
  500.     {
  501.         headsUpDisplay -e -vis $visibility HUDPolyCountVerts;
  502.     }
  503.     if (`headsUpDisplay -ex HUDPolyCountEdges`)
  504.     {
  505.         headsUpDisplay -e -vis $visibility HUDPolyCountEdges;
  506.     }
  507.     if (`headsUpDisplay -ex HUDPolyCountFaces`)
  508.     {
  509.         headsUpDisplay -e -vis $visibility HUDPolyCountFaces;
  510.     }
  511.     if (`headsUpDisplay -ex HUDPolyCountUVs`)
  512.     {
  513.         headsUpDisplay -e -vis $visibility HUDPolyCountUVs;
  514.     }
  515.  
  516.     //Update the respective menu item and optionVar
  517.     menuItem -e -cb $visibility polyCountItem;
  518.     optionVar -iv "polyCountVisibility" $visibility;
  519. }
  520.  
  521. global proc setCameraNamesVisibility(int $visibility)
  522. {
  523.     if (`headsUpDisplay -ex HUDCameraNames`)
  524.     {
  525.         headsUpDisplay -e -vis $visibility HUDCameraNames;
  526.     }
  527.  
  528.     //Update the respective menu item and optionVar
  529.     menuItem -e -cb $visibility cameraNamesItem;
  530.     optionVar -iv "cameraNamesVisibility" $visibility;
  531. }
  532.  
  533. global proc setFrameRateVisibility(int $visibility)
  534. {
  535.     if (`headsUpDisplay -ex HUDFrameRate`)
  536.     {
  537.         headsUpDisplay -e -vis $visibility HUDFrameRate;
  538.     }
  539.  
  540.     //Update the respective menu item and optionVar
  541.     menuItem -e -cb $visibility frameRateItem;
  542.     optionVar -iv "frameRateVisibility" $visibility;
  543. }
  544.  
  545. global proc setViewAxisVisibility(int $visibility)
  546. {
  547.     if (`headsUpDisplay -ex HUDViewAxis`)
  548.     {
  549.         headsUpDisplay -e -vis $visibility HUDViewAxis;
  550.     }
  551.  
  552.     //Update the respective menu item and optionVar
  553.     menuItem -e -cb $visibility viewAxisItem;
  554.     optionVar -iv "viewAxisVisibility" $visibility;
  555. }
  556.  
  557. global proc setAnimationDetailsVisibility(int $visibility)
  558. {
  559.     if (`headsUpDisplay -ex HUDIKSolverState`)
  560.     {
  561.         headsUpDisplay -e -vis $visibility HUDIKSolverState;
  562.     }
  563.     if (`headsUpDisplay -ex HUDCurrentCharacter`)
  564.     {
  565.         headsUpDisplay -e -vis $visibility HUDCurrentCharacter;
  566.     }
  567.     if (`headsUpDisplay -ex HUDPlaybackSpeed`)
  568.     {
  569.         headsUpDisplay -e -vis $visibility HUDPlaybackSpeed;
  570.     }
  571.  
  572.     // Begin scriptJob to force update of animated ikSolver states.
  573.     //
  574.     global int $gHUDupdateIKScriptJobExists = 0;
  575.     global int $gHUDupdateIKScriptJob = 0;
  576.     if( $visibility ) {
  577.         if( !$gHUDupdateIKScriptJobExists ) {
  578.             if( `headsUpDisplay -exists HUDIKSolverState` ) {
  579.                 $gHUDupdateIKScriptJob = `scriptJob -event timeChanged 
  580.                     "headsUpDisplay -refresh HUDIKSolverState"`;
  581.                 $gHUDupdateIKScriptJobExists = 1;
  582.             }
  583.         }
  584.     } else {
  585.         if( $gHUDupdateIKScriptJobExists ) {
  586.             catch( `scriptJob -kill $gHUDupdateIKScriptJob` );
  587.         }
  588.         $gHUDupdateIKScriptJob = 0;
  589.         $gHUDupdateIKScriptJobExists = 0;
  590.     }
  591.     // 
  592.     // End scriptJob to force update of animated ikSolver states.
  593.     
  594.     //Update the respective menu item and optionVar
  595.     menuItem -e -cb $visibility animationDetailsItem;
  596.     optionVar -iv "animationDetailsVisibility" $visibility;
  597. }
  598.  
  599. global proc string animationDetailsIKFK()
  600. //
  601. //    Description:
  602. //        Returns a string describing the solver enable state of the
  603. //        selected joint chains.
  604. //
  605. //        There are five different returned strings:
  606. //            "None Selected"    :    No joints or ikHandles are selected.
  607. //            "On"            :    The selected items have their solver enabled.
  608. //            "Off"            :    The selected items have their solver disabled.
  609. //            "No Solver"        :    No solver on the selcted joints.
  610. //            "Mixed"            :    Some of the selected items have their solvers 
  611. //                                enabled and others have their solvers disabled.
  612. //        
  613. {
  614.     int $lastMenuSwitchState = `optionVar -q ikFKSwitchState`;
  615.  
  616.     //    There are five different returned values from ikFKSolverState()
  617.     //        0    :    No joints or ikHandles are selected.
  618.     //        1    :    The selected items have their solver enabled.
  619.     //        2     :    The selected items have their solver disabled.
  620.     //        3     :    No solver on the selcted joints.
  621.     //        4     :    Some of the selected items have their solvers 
  622.     //                enabled and others have their solvers disabled.
  623.     //
  624.     int $solverState = ikFKSolverState(`ls -sl`);
  625.  
  626.     string $result;
  627.     switch ($solverState) {
  628.         case 1:
  629.             float $blendValue = ikFkBlendValue(`ls -sl`);
  630.             if ($blendValue > 0.0) {
  631.                 $result = $blendValue;
  632.             } else {
  633.                 $result = "Mixed";
  634.             }
  635.             if (on != $lastMenuSwitchState &&
  636.                 `exists updateIKFKCheckBox`) {
  637.                 updateIKFKCheckBox(on);
  638.             }
  639.             break;
  640.         case 2:
  641.             $result = "Off";
  642.             if (off != $lastMenuSwitchState &&
  643.                 `exists updateIKFKCheckBox`) {
  644.                 updateIKFKCheckBox(off);
  645.             }
  646.             break;
  647.         case 3:
  648.             $result = "No Solver";
  649.             break;
  650.         case 4:
  651.             $result = "Mixed";
  652.             if (!$lastMenuSwitchState &&
  653.                 `exists updateIKFKCheckBox`) {
  654.                 updateIKFKCheckBox(on);
  655.             }
  656.             break;
  657.         case 0:
  658.         default:
  659.             $result = "No Solver";
  660.             break;
  661.     }
  662.  
  663.     return $result;
  664. }
  665.  
  666. global proc string animationDetailsCurrentCharacter()
  667. {
  668.     string $text = "No Character";
  669.  
  670.     string $currentCharacters[] = currentCharacters();
  671.     int $size = size( $currentCharacters );
  672.  
  673.     if ( $size > 0 ) {
  674.         if ( $size == 1 ) {
  675.             $text = $currentCharacters[0];
  676.         } else {
  677.             $text = "multiple";
  678.         }
  679.     }
  680.  
  681.     return $text;
  682. }
  683.  
  684. global proc string animationDetailsPlaybackSpeed()
  685. {
  686.     string $text = "N/A";
  687.     float   $speed = `playbackOptions -q -playbackSpeed`;
  688.     
  689.     string $unit = `currentUnit -q -time`;
  690.     float  $fps = 0;
  691.  
  692.     if( $unit == "game" ) {
  693.         $fps = 15;
  694.     } else if( $unit == "film" ) {
  695.         $fps = 24;
  696.     } else if( $unit == "pal" ) {
  697.         $fps = 25;
  698.     } else if( $unit == "ntsc" ) {
  699.         $fps = 30;
  700.     } else if( $unit == "show" ) {
  701.         $fps = 48;
  702.     } else if( $unit == "palf" ) {
  703.         $fps = 50;
  704.     } else if( $unit == "ntscf" ) {
  705.         $fps = 60;
  706.     }
  707.  
  708.     if (equivalent($speed,0.0)) {
  709.         $text = "Every Frame ";
  710.     } else if (equivalent($speed,0.5)) {
  711.         $text = "Half ";
  712.     } else if (equivalent($speed,1.0)) {
  713.         $text = "Real";
  714.     } else if (equivalent($speed,2.0)) {
  715.         $text = "Twice ";
  716.     } else {
  717.         $text = "Other ";
  718.     }
  719.  
  720.     float $rate = $fps * $speed;
  721.     if (!equivalent($rate, 0.0)) {
  722.         $text += (" [" + ($rate) + " fps]");
  723.     } 
  724.  
  725.     return $text;
  726. }
  727.  
  728. global proc updateCurrentCharacterHUD()
  729. //
  730. //    Description:
  731. //        The global proc to update the current character HUD.
  732. //
  733. {
  734.     //    This will update the display for the character field.
  735.     //
  736.     if (`headsUpDisplay -ex HUDCurrentCharacter`)
  737.     {
  738.         headsUpDisplay -refresh HUDCurrentCharacter;
  739.     }
  740. }
  741.  
  742. global proc updatePlaybackSpeedHUD()
  743. {
  744.     if (`headsUpDisplay -ex HUDPlaybackSpeed`)
  745.     {
  746.         headsUpDisplay -refresh HUDPlaybackSpeed;
  747.     }
  748. }
  749.